import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * This class represents the abstract Supertype for any concrete Planet Subtype.
 * <br /><br />
 * It is responsible for associating any Planet with the given Cost and its Goal Planet identity.
 * 
 * @author (Dilyan GEORGIEV)
 * @author (Thomas KOBER)
 * @author (Matthew MCDONALD)
 * 
 * @version (1.0)
 */
public abstract class Planet extends Actor
{
    ////////////////////////////////////////////////////////////////////////////////
    // Field Declarations
    ////////////////////////////////////////////////////////////////////////////////
    
    // The Cost associated with the Planet
    private Cost    cost;
    // The Flag indicating whether or not the Planet is a Goal Planet
    private boolean goalPlanet = false;
    
    ////////////////////////////////////////////////////////////////////////////////
    // Public Implementation
    ////////////////////////////////////////////////////////////////////////////////
    
    /**
     * Returns the Cost Object, associated with the Planet.
     * @return the Cost Object, associated with the Planet. 
     */
    public Cost getCost()
    {
        return this.cost;
    }
    
    /**
     * Connects the Planet with the given Cost Object.
     * @param cost the Cost Object to associate the Planet with.
     */
    public void setCost(Cost cost)
    {
        this.cost = cost;
    }
    
    /**
     * Sets whether or not the Planet is a Goal Planet.
     * @param isGoalPlanet true sets the Planet to be a Goal Planet, false sets it to be a non-Goal Planet.
     */
    public void setGoalPlanet(boolean isGoalPlanet)
    {
        this.goalPlanet = isGoalPlanet;
    }
    
    /**
     * Returns whether or not the Planet is a Goal Planet.
     * @return true if the Planet is a Goal Planet, false otherwise.
     */
    public boolean isGoalPlanet()
    {
        return this.goalPlanet;
    }
   
    public abstract boolean equals(Object o);
    
    public int hashCode()
    {
        int result = 17;
        
        result = 37 * result + this.cost.hashCode();
        result = 37 * result + ((this.goalPlanet) ? 1 : 0);
        
        return result;
    }
    
    /**
     * Act - do whatever the Planet wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {}    
}
